//
//  MineCell.swift
//  FirstSwiftProduct
//
//  Created by 知合金服-Mini on 2017/12/4.
//  Copyright © 2017年 范泽华. All rights reserved.
//

import UIKit

class MineCell: UITableViewCell {

    
    var headImageView : UIImageView!
    var headLabel : UILabel!
    var headDetailLabel :UILabel!
    var rightImageView :UIImageView!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        rightImageView  = UIImageView.init(frame: CGRect(x: SCREEN_WIDTH - 20, y: 0, width: 8, height:13))
        rightImageView.center.y = self.centerY
        self.contentView.addSubview(rightImageView)
        rightImageView.image = UIImage.init(named: "ProfileLockOn")
        
        
        headImageView = UIImageView.init(frame: CGRect(x: 5, y: 5, width: self.contentView.frame.size.height - 10, height: self.contentView.frame.size.height - 10))
        headImageView.layer.cornerRadius = 2
        headImageView.layer.masksToBounds = true
        
        headLabel = UILabel.init(frame: CGRect(x: self.frame.size.height, y: 0 , width: self.frame.size.width - self.frame.size.height, height: self.frame.size.height/2))
        headLabel.font = UIFont.systemFont(ofSize: 20)
        headLabel.sizeToFit()
        
        headDetailLabel = UILabel.init(frame: CGRect(x: self.frame.size.height , y: self.frame.size.height/2, width: self.frame.size.width - self.frame.size.height, height: self.frame.size.height/2))
        headDetailLabel.font = UIFont.systemFont(ofSize: 14)
        headDetailLabel.sizeToFit()
        
        self.contentView.addSubview(headImageView)
        self.contentView.addSubview(headLabel)
        self.contentView.addSubview(headDetailLabel)
        
        

    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func layoutSubviews() {
//        headImageView = UIImageView.init(frame: CGRect(x: 5, y: 5, width: self.contentView.frame.size.height - 10, height: self.contentView.frame.size.height - 10))
        headImageView.frame = CGRect(x: 5, y: 5, width: self.contentView.frame.size.height - 10, height: self.contentView.frame.size.height - 10)

        headLabel.frame = CGRect(x: self.frame.size.height + 5, y: self.frame.size.height/4 , width: self.frame.size.width - self.frame.size.height, height: self.frame.size.height/4)
        
        headDetailLabel.frame = CGRect(x: self.frame.size.height + 5, y: self.frame.size.height/2 + 5 , width: self.frame.size.width - self.frame.size.height, height: self.frame.size.height/4)
        
        rightImageView.frame = CGRect(x: SCREEN_WIDTH - 30, y: self.frame.size.height/2 - 13/2, width: 20, height: 20)
//        rightImageView.frame = CGRect(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.height)
        
    }
}
